home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / isetl.arc / med2.t < prev    next >
Text File  |  1987-08-20  |  248b  |  19 lines

  1. $ median.test
  2.  
  3. med := func(s1);
  4.     local t,u;
  5.     t := func(x);
  6.         return {y: y in s1| y<x};
  7.          end;
  8.     u := func(x);
  9.         return {y: y in s1| y>x};
  10.          end;
  11.     return {x: x in s1| (#(t(x)) = #(u(x)))};
  12.     end;
  13.  
  14. for n in [1..7] do
  15.     print med({1..n});
  16. end;
  17.  
  18.  
  19.